package com.cxy.hmall.wx.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.cxy.hmall.db.domain.HRegion;
import com.cxy.hmall.db.service.HRegionService;

/**
 * @author cxy
 * @since 1.0.0
 * @date 2021-04-11 11:07
 **/
@Component
public class GetRegionService {

	@Autowired
	private HRegionService regionService;

	private static List<HRegion> hRegions;

	protected List<HRegion> getDtsRegions() {
		if (hRegions == null) {
			createRegion();
		}
		return hRegions;
	}

	private synchronized void createRegion() {
		if (hRegions == null) {
			hRegions = regionService.getAll();
		}
	}
}
